Ext.define('jwawa.erp.home.ChangePasswordHandler', {
    extend : "jwawa.erp.framework.ShellHandler",
    ref:{
        confirmButton: 'button[action=confirm]',
        closeButton: 'button[action=close]'
    },
    bindHandler : function() {
        var me = this,
            view = me.view;
//        var changPwdForm = me.items.map['changPwdForm']
//        var changPwdForm = me.items.getByKey('changPwdForm')
//        me.callParent(arguments);

        me.confirmButton.on("click", function(btn, e, scope) {
            this.changePwd(btn, e, scope);
//            this.fireEvent('changePasswordConfirm', this, 'test msg');
        }, me);

        me.closeButton.on("click", function(btn, e, scope) {
            this.closeChangePwd(btn, e, scope);
        }, me);
    },
//    beforeInitComponent : function(){
//        me = this;
//        me.addEvents('changePasswordConfirm', 'changePasswordClose');
//    } ,
    closeChangePwd: function(btn, e, scope) {
        var win = btn.up('window');
        if (win != null) {
            win.close();
        }
    },
    changePwd: function(btn, e, scope) {
        var form = btn.up('form').getForm();
//        var win = btn.up('window');
        if (form.isValid()) {
//            form.doAction('jwawaSubmit', {
//                success: function(form, action) {
//                    top.msgBar.showInfoMsg('密码修改成功');
//                }
//            });
            form.submit({
                success: function(form, action) {
                    top.msgBar.showInfoMsg('密码修改成功');
                }
            });
        }
    }
});

